<?php
require_once("../db/db_connector.php");
require_once("../db/db_video.php");

// Database Access Begins ---------------------------------------- //
$con = get_db_con();
$video_list = get_video_list($con);
close_db_con();
// Database Access Ends ------------------------------------------ //

?>

<?php
include_once("../include/admin_header.php");
?>

<h2>Video</h2>
<a href="video_edit.php">Create Video</a>
<table>
	<tr>
		<th>id</th>
		<th>title</th>
		<th>description</th>
		<th>paradise_id</th>
		<th>user_id</th>
		<th>youtube_id</th>
	</tr>
<?php foreach ($video_list as $video): ?>
	<tr>
		<td><?=$video["id"]?></td>
		<td><?=$video["title"]?></td>
		<td><?=$video["description"]?></td>
		<td><?=$video["paradise_id"]?></td>
		<td><?=$video["user_id"]?></td>
		<td>
			<a href="<?="http://www.youtube.com/watch?v=" . $video["youtube_id"]?>" target="_blank">
				<img src="http://img.youtube.com/vi/<?=$video["youtube_id"]?>/mqdefault.jpg" />
			</a>
		</td>
	</tr>
<?php endforeach ?>
</table>

<?php
include_once("../include/admin_footer.php");
?>
